
#include<iostream>
#include <vector>
using namespace std;
int a, b, c;
int ans = 0;

int main()
{
    cin >> a >> b >> c;
    vector<vector<int>> arr;
    arr.resize(a);
    for(int i=0;i<a;i++) arr[i].resize(b);
    while (c--)
    {
        int l = 0;
        int r = 0;
        cin >> l >> r;
        if (l == 0)
        {
            for (int i = 0; i < b; i++)
                arr[r - 1][i]++;
        }
        else
        {
            for (int i = 0; i < a; i++)
                arr[i][r - 1]++;
        }
    }
    for (int i = 0; i < a; i++)
    {
        for (int j = 0; j < b; j++)
        {
            if (arr[i][j] != 0)
                ans++;
        }
    }
    int sum = a * b;
    ans = sum - ans;
    cout << ans;
    return 0;
}
